package com.ybb.vue.domain.dto;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

@Data
public class UserDto {
    private String id;
    @NotBlank(message = "用户名不能为空")
    @Length(max = 5,message = "用户名不能超过5个字符")
    private String username;
    @NotBlank(message = "昵称不能为空")
    @Size(max = 5,message = "昵称不能超过五个字符")
    private String nickName;
    private String avatar;
    @NotNull(message = "邮箱不能为空")
    @Pattern(regexp = "^[A-Za-z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$",message = "邮箱格式有误")
    private String email;
    @NotNull(message = "联系电话不能为空")
    @Pattern(regexp = "^[\\d\\*]{7,12}$", message = "联系电话格式有误")
    private String phonenumber;
    @NotNull(message = "年龄不能为空")
    @Min(value = 12,message = "年龄不能小于12岁")
    @Max(value = 100,message = "年龄不能大于100岁")
    private Integer age;
    @NotBlank(message = "性别不能为空")
    private String sex;
    @NotBlank(message = "地址不能为空")
    @Length(max = 30,message = "地址信息长度超过30")
    private String address;
}
